package com.zhkj.txg.module.order.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zhkj.lib.utils.SpanUtil
import com.zhkj.txg.R
import com.zhkj.txg.module.order.entity.OrderListGoodsEntity
import com.zhkj.txg.utils.ImageUtils

class OrderListGoodsAdapter() : BaseQuickAdapter<OrderListGoodsEntity, BaseViewHolder>(R.layout.item_order_goods) {

    var mType: Int = 0

    override fun convert(helper: BaseViewHolder, item: OrderListGoodsEntity) {
        val imageView = helper.setText(R.id.tvOrderGoodsName, item.goodsName)
//            .setVisible(R.id.text_people, mType != 0)//X人拼
//            .setText(R.id.text_people, if (item?.people.isNullOrBlank()) "" else "${item?.people}人拼")//X人拼
            .setText(
                R.id.tvOrderGoodsPrice,
                SpanUtil.setMoneySymbol(item.goodsPrice, item.shareEarn != null && item.shareEarn > 0)
            )
            .setText(R.id.tvOrderGoodsNumber, "x${item.goodsNum}")
            .getView<ImageView>(R.id.ivOrderGoods)
        ImageUtils.loadRoundCornerImage(context, imageView, item.image)
    }
}